package com.dormms.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dormms.dao.UserDao;
import com.dormms.dao.UserRoleDtoDao;
import com.dormms.dto.UserRoleDto;
import com.dormms.service.LoginService;
@Service
public class LoginServiceImpl implements LoginService{
	@Autowired
	private UserDao userDao;
	@Autowired
	private UserRoleDtoDao userRoleDtoDao;

	public boolean isLegalUser(String userid, String password) {
		// TODO Auto-generated method stub
		String userpass = userDao.getPasswordByUserid(userid);
		if(password.equals(userpass)) {
			return true;
		}
		return false;
	}

	public UserRoleDto getUserRoleByUserId(String userid) {
		// TODO Auto-generated method stub
		UserRoleDto userRoleDto = userRoleDtoDao.getUserRoleDtoByUserId(userid);
		return userRoleDto;
	}

	public UserDao getUserDao() {
		return userDao;
	}

	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}

	public UserRoleDtoDao getUserRoleDao() {
		return userRoleDtoDao;
	}

	public void setUserRoleDao(UserRoleDtoDao userRoleDao) {
		this.userRoleDtoDao = userRoleDao;
	}

}
